﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using Framework.Common.Attributes;

namespace Framework.Sample
{
    [OrderedDesc("2)    特性")]
    class Test2 : ITest
    {
        public void Run()
        {
            typeof(CommentAudit).Print();
            var list = typeof(CommentAudit).GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic).ToArray();
            list.Each(i =>
            {
                Console.WriteLine(i.Name);
                var data = i.GetCustomAttributesData();
                OrderedDescAttribute obj = (OrderedDescAttribute)i.GetCustomAttributes(typeof(Framework.Common.Attributes.OrderedDescAttribute), false)[0];
                Console.WriteLine(obj.Description);
                Console.WriteLine(i.GetRawConstantValue());
            });
        }
    }


    /// <summary>
    /// 评论审核状态 5~-3 未审核的 显示(3-10)
    /// </summary>
    public enum CommentAudit
    {
        /// <summary>
        /// 审核通过的
        /// </summary>
        [OrderedDesc("审核通过", 10)]
        Publish = 10,

        /// <summary>
        /// 发布正常(无关键字)
        /// </summary>
        [OrderedDesc("正常", 5)]
        PublishNormal = 5,

        /// <summary>
        /// 先发后审
        /// </summary>
        [OrderedDesc("先发后审", 3)]
        PublishThenAudit = 3,

        //-----------------以下是前台不显示的

        /// <summary>
        /// 未用过
        /// </summary>
        [OrderedDesc("未审核", 0)]
        UnAudit = 0,

        /// <summary>
        /// 被博主删除,但在个人页上显示
        /// </summary>
        [OrderedDesc("被博主删除", -1)]
        DeleteByBlogOwner = -1,

        /// <summary>
        /// 先审后发
        /// </summary>
        [OrderedDesc("先审后发", -3)]
        AuditThenPublish = -3,

        //-----------------以下是被删除的---------------
        /// <summary>
        /// 自己删除的
        /// </summary>
        [OrderedDesc("自行删除", -5)]
        DeleteBySelf = -5,

        /// <summary>
        /// 先发后审被管理员删除的
        /// </summary>
        [OrderedDesc("先发后审被删除", -10)]
        DeletePublishThenAudit = -10,

        /// <summary>
        /// 先审后发被管理员删除的
        /// </summary>
        [OrderedDesc("先审后发被删除", -12)]
        DeleteAuditThenPublish = -12,

        /// <summary>
        /// 海量系统删除
        /// </summary>
        [OrderedDesc("被海量系统删除", -14)]
        DeleteByHaiLiang = -14,

        /// <summary>
        /// 被管理员删除
        /// </summary>
        [OrderedDesc("被管理员删除", -16)]
        DeleteByAdmin = -16,

        /// <summary>
        /// 看点被删除联带评论也被删除
        /// </summary>
        [OrderedDesc("文章被删除评论联带删除", -18)]
        DeleteByArticleDelete = -18
    }
}
